/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mortbay.jetty.pico.components;

import java.util.List;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.mortbay.jetty.pico.dao.category.CategoryDAO;
import org.mortbay.jetty.pico.entities.Category;

/**
 *
 * @author godfather
 */
public class MainMenu {

//    @Parameter(required=true, defaultPrefix="literal")
//    private String defaultPage;
    @Property
    private Category category;
    @Property
    private Category sub_category;
    @Property
    private List<Category> categories;
    @Inject
    private CategoryDAO categoryDAO;


    public CategoryDAO getCategoryDAO() {
        return categoryDAO;
    }

    @SetupRender
    boolean listCategorys() {
        this.categories = categoryDAO.getParentCategories();
        return categories.size() > 1 ? true : false;
    }

    @OnEvent
    public Object viewCategory() {
        return Category.class;
    }

//    public String getDefaultPage() {
//        return defaultPage;
//    }
}
